<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%-- 设置页面标题 --%>
<c:set var="title" value="个人中心" scope="request"/>
<%@ include file="../common/header.jsp" %>

<div class="container mt-4">
    <h2 class="text-center mb-4">${title}</h2>

    <c:if test="${not empty success}">
        <div class="alert alert-success success-message" role="alert">
            ${success}
        </div>
    </c:if>
    <c:if test="${not empty error}">
        <div class="alert alert-danger error-message" role="alert">
            ${error}
        </div>
    </c:if>

    <h4 class="section-title">个人信息</h4>
    <div class="row mb-3">
        <div class="col-md-6">
            <p><span class="info-label">账号：</span>${user.username}</p>
            <p><span class="info-label">姓名：</span>${user.realName}</p>
        </div>
        <div class="col-md-6">
            <p><span class="info-label">电话：</span>${user.phone}</p>
            <p><span class="info-label">邮箱：</span>${user.email}</p>
        </div>
    </div>

    <h4 class="section-title mt-4">修改密码</h4>
    <form action="${pageContext.request.contextPath}/user/update-password" method="post">
        <div class="mb-3">
            <label for="oldPassword" class="form-label">旧密码</label>
            <input type="password" class="form-control" id="oldPassword" name="oldPassword" required>
        </div>
        <div class="mb-3">
            <label for="newPassword" class="form-label">新密码</label>
            <input type="password" class="form-control" id="newPassword" name="newPassword" required>
        </div>
        <div class="mb-3">
            <label for="confirmNewPassword" class="form-label">确认新密码</label>
            <input type="password" class="form-control" id="confirmNewPassword" name="confirmNewPassword" required>
        </div>
        <div class="d-grid">
            <button type="submit" class="btn btn-primary">修改密码</button>
        </div>
    </form>

    <div class="mt-4 text-center">
        <a href="javascript:history.back()" class="btn btn-secondary">返回</a>
    </div>
</div>

<%@ include file="/WEB-INF/views/common/footer.jsp" %> 